var TOC = (function ($) {

  var _body = $(document.body),
      _container = $('.toc-container'),
      _tocContent;

  function btnOnClick(e) {
    _container.addClass('open');
  }

  function tocOnMouseOut(e){
    _container.removeClass('open');
  }

  var module = {
    init: function (){
      _container = _body.find('.toc-container');
      if(! _container.length){return;}

      _tocContent = _container.find('.toc');
      if(! _tocContent.find('.header').length) {
        _tocContent.prepend('<h2 class="header">overview</h2>');
      }

      _container.off('mouseenter', btnOnClick)
      _tocContent.off('mouseleave', tocOnMouseOut);

      _container.on('mouseenter', '.toc-btn', btnOnClick);
      _tocContent.on('mouseleave', tocOnMouseOut);
    },
    open: function(e){
    }

  }

  return {
    init: module.init,
    open: module.open
  }

}(jQuery));
